<?php

namespace App\Modules\Comment\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * Class Comment
 * @package App\Modules\Coupon\Models
 * @property int $user_id
 * @property int $link_id
 * @property string $type
 * @property int $score
 * @property string $content
 * @property array $image
 * @property int $is_checked
 * @property int $is_show
 */
class Comment extends Model
{


    const TYPE_GOOD = 'good';
    const TYPE_PACKAGE = 'package';
    const TYPE_CROWD = 'crowd';

    public function getTypeAttribute($value)
    {
        if ($value == self::TYPE_CROWD) {
            $value = "众筹";
        } elseif ($value == self::TYPE_PACKAGE) {
            $value = "套系";
        } else {
            $value = "商品";
        }
        return $value;
    }

    protected $fillable = [
        'user_id',
        'link_id',
        'shop_id',
        'type',
        'score',
        'content',
        'image',
        'is_checked',
        'is_show',
        'pid',
        'system_reply',//系统回复
        'system_responder',//系统回复人员
        'merchant_reply',//商家回复人员
        'merchant_reply_username',//商家回复人员账户
        'system_reply_username',//系统回复人员账户
        'order_id',
    ];

    protected $casts = [
        'image' => 'array',
    ];
}
